<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div class="content-parent border-hover-style">
      <div class="audio-parent" v-if="props.info.audio && props.info.audio.url">
        <audioCom :info="props.info" ref="audioParent" />
      </div>
      <div
        class="content-bg"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style14/auxiliaryStyle2Bg.webp'})`,
        }"
      >
        <div class="content-box">
          <p class="title" v-if="props.info.text">{{ props.info.text }}</p>
          <div class="bottom-box">
            <div
              class="left-content"
              v-if="props.info.subTitle || props.info.remarks"
              :class="{ 'null-image-video': !props.info.video?.url && !props.info.value }"
            >
              <p class="sub-title" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
              <div class="remarks1" v-if="(props.info.video && props.info.video?.url) || props.info.value">
                <TextMax
                  :color2="false"
                  :infoData="props.info"
                  v-if="props.domShow"
                  :data="props.info.remarks"
                  :title="props.info.text"
                  :row="4"
                ></TextMax>
              </div>
              <div class="remarks2" :class="{ remarks3: !props.info.subTitle }" v-else-if="props.info.remarks">
                <TextMax
                  :color2="false"
                  :infoData="props.info"
                  v-if="props.domShow"
                  :data="props.info.remarks"
                  :title="props.info.text"
                  :row="props.info.subTitle ? 5 : 6"
                ></TextMax>
              </div>
            </div>
            <div
              class="right-content"
              :class="{ 'null-subTitle-remarks': !props.info.subTitle && !props.info.remarks }"
              v-if="(props.info.video && props.info.video?.url) || props.info.value"
            >
              <div class="video-image">
                <videoview
                  @click="audioplay(false)"
                  :info="props.info"
                  v-if="props.info.video && props.info.video?.url"
                ></videoview>
                <img
                  @click="ImgVisible = true"
                  :src="urls + props.info.value + '?imageView2/3/format/webp'"
                  alt=""
                  v-else
                />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free14Style2',
});
</script>
<script lang="ts" setup>
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/textMax14.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
  indexs: {
    type: Number || String,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style lang="less" scoped>
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  padding-top: 100px;
  height: 100%;
  margin-right: 140px;
}
.content-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 847px;
  height: 400px;

  -webkit-box-reflect: below 34% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.audio-parent {
  position: absolute;
  right: 130px;
  top: 10px;
}
.content-bg {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.content-box {
  position: absolute;
  right: 80px;
  bottom: 42px;
  width: 632px;
  height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.title {
  color: #3486f3;
  text-align: center;
  flex-shrink: 0;
  /* 三级标题 */
  font-family: 'SourceHanSerifCN';
  font-size: 20px;
  font-style: normal;
  font-weight: 700;
  line-height: 30px; /* 150% */
}
.bottom-box {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}
.left-content {
  width: 330px;
}
.null-image-video {
  width: 512px;
}
.sub-title {
  width: 100%;
  color: #333;
  text-align: center;

  /* 三级副标 */
  font-family: 'SourceHanSerifCN';
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 28px; /* 175% */
}
.remarks1 {
  width: 100%;
  margin-top: 12px;
}
.remarks2 {
  width: 100%;
  margin-top: 12px;
}
.right-content {
  width: 160px;
  height: 206px;
  flex-shrink: 0;
  margin-left: 20px;
}
.null-subTitle-remarks {
  width: 512px;
  margin: 0;
}
.video-image {
  width: 100%;
  height: 100%;
  background: #f2e9d3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s;
  }
}
.video-image:hover {
  img {
    transform: scale(1.2);
  }
}
</style>
